// const { model } = require("mongoose");


// 返回4位数的验证码
function getCode() {
    let codetime = parseInt(Math.random() * 10000)
    if (codetime >= 0 && codetime < 10) {
        return `000${codetime}`;
    } else if (codetime >= 10 && codetime < 100) {
        return `00${codetime}`
    } else if (codetime >= 100 && codetime < 1000) {
        return `0${codetime}`
    }
    else if (codetime >= 1000 && codetime < 10000) {
        return `${codetime}`
    }
}

// 判断是否是同一天
function is_same_day(t) {
    return new Date(t).toDateString() == new Date().toDateString();
  }

module.exports = {
    getCode,
    is_same_day
}

